<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class GetDate{
            constructor(current = new Date()){
                this.current= current
            }
            // getter函数 定义属性
            get firstday(){
                console.log(11111)
                const date = new Date(this.current)
                date.setDate(14)
                const date1 = date.getDate()
                const day = date.getDay()||7
                return { date1,day}
            }
            get lastdata(){
                const date = new Date(this.current)
                date.setMonth(date.getMonth()+1)
                date.setDate(0)
                const lastdate = date.getDate()
                const day = date.getDay()||7
                return { lastdate,day}
            }

        }
        const getdate = new GetDate()
        console.log(getdate)
        console.log(getdate.lastdata)
    
    </script>
</body>
</html>